package com.heima.controller;

import lombok.Data;

import java.io.Serializable;

@Data
public class Result<T> implements Serializable {

    private Integer pageIndex;

    private Integer pageSize;

    private Long totalPage;

    private Long totalCount;
    ;

    private T currentPageRecords;

    public static <T> Result<T> success(Integer pageIndex, Integer pageSize, Long totalPage, Long totalCount, T object) {
        Result<T> result = new Result<T>();
        result.pageIndex = pageIndex;
        result.pageSize = pageSize;
        result.totalPage = totalPage;
        result.totalCount = totalCount;
        result.currentPageRecords = object;
        return result;
    }

    public static <T> Result<T> success(T object) {
        Result<T> result = new Result<T>();
        result.currentPageRecords = object;
        return result;
    }

    public static <T> Result<T> fail(T object) {
        Result<T> result = new Result<T>();
        result.currentPageRecords = object;
        return result;
    }


}



